3.3.58 \(\int \tan (c+d x) (a+b \tan (c+d x))^4 (A+B \tan (c+d x)) \, dx\) [258]

3.3.58.1 Optimal result
3.3.58.2 Mathematica [C] (verified)
3.3.58.3 Rubi [A] (verified)
3.3.58.4 Maple [A] (verified)
3.3.58.5 Fricas [A] (verification not implemented)
3.3.58.6 Sympy [B] (verification not implemented)
3.3.58.7 Maxima [A] (verification not implemented)
3.3.58.8 Giac [B] (verification not implemented)
3.3.58.9 Mupad [B] (verification not implemented)

3.3.58.1 Optimal result

Integrand size = 29, antiderivative size = 226 \[ \int \tan (c+d x) (a+b \tan (c+d x))^4 (A+B \tan (c+d x)) \, dx=-\left (\left (4 a^3 A b-4 a A b^3+a^4 B-6 a^2 b^2 B+b^4 B\right ) x\right )-\frac {\left (a^4 A-6 a^2 A b^2+A b^4-4 a^3 b B+4 a b^3 B\right ) \log (\cos (c+d x))}{d}+\frac {b \left (a^3 A-3 a A b^2-3 a^2 b B+b^3 B\right ) \tan (c+d x)}{d}+\frac {\left (a^2 A-A b^2-2 a b B\right ) (a+b \tan (c+d x))^2}{2 d}+\frac {(a A-b B) (a+b \tan (c+d x))^3}{3 d}+\frac {A (a+b \tan (c+d x))^4}{4 d}+\frac {B (a+b \tan (c+d x))^5}{5 b d} \]

output
-(4*A*a^3*b-4*A*a*b^3+B*a^4-6*B*a^2*b^2+B*b^4)*x-(A*a^4-6*A*a^2*b^2+A*b^4- 
4*B*a^3*b+4*B*a*b^3)*ln(cos(d*x+c))/d+b*(A*a^3-3*A*a*b^2-3*B*a^2*b+B*b^3)* 
tan(d*x+c)/d+1/2*(A*a^2-A*b^2-2*B*a*b)*(a+b*tan(d*x+c))^2/d+1/3*(A*a-B*b)* 
(a+b*tan(d*x+c))^3/d+1/4*A*(a+b*tan(d*x+c))^4/d+1/5*B*(a+b*tan(d*x+c))^5/b 
/d
 
3.3.58.2 Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 3.54 (sec) , antiderivative size = 257, normalized size of antiderivative = 1.14 \[ \int \tan (c+d x) (a+b \tan (c+d x))^4 (A+B \tan (c+d x)) \, dx=\frac {12 B (a+b \tan (c+d x))^5+10 (a A+b B) \left (3 i (a+i b)^4 \log (i-\tan (c+d x))-3 i (a-i b)^4 \log (i+\tan (c+d x))+6 b^2 \left (-6 a^2+b^2\right ) \tan (c+d x)-12 a b^3 \tan ^2(c+d x)-2 b^4 \tan ^3(c+d x)\right )-5 A \left (6 i (a+i b)^5 \log (i-\tan (c+d x))-6 (i a+b)^5 \log (i+\tan (c+d x))-60 a b^2 \left (2 a^2-b^2\right ) \tan (c+d x)+6 b^3 \left (-10 a^2+b^2\right ) \tan ^2(c+d x)-20 a b^4 \tan ^3(c+d x)-3 b^5 \tan ^4(c+d x)\right )}{60 b d} \]

input
Integrate[Tan[c + d*x]*(a + b*Tan[c + d*x])^4*(A + B*Tan[c + d*x]),x]
 
output
(12*B*(a + b*Tan[c + d*x])^5 + 10*(a*A + b*B)*((3*I)*(a + I*b)^4*Log[I - T 
an[c + d*x]] - (3*I)*(a - I*b)^4*Log[I + Tan[c + d*x]] + 6*b^2*(-6*a^2 + b 
^2)*Tan[c + d*x] - 12*a*b^3*Tan[c + d*x]^2 - 2*b^4*Tan[c + d*x]^3) - 5*A*( 
(6*I)*(a + I*b)^5*Log[I - Tan[c + d*x]] - 6*(I*a + b)^5*Log[I + Tan[c + d* 
x]] - 60*a*b^2*(2*a^2 - b^2)*Tan[c + d*x] + 6*b^3*(-10*a^2 + b^2)*Tan[c + 
d*x]^2 - 20*a*b^4*Tan[c + d*x]^3 - 3*b^5*Tan[c + d*x]^4))/(60*b*d)
 
3.3.58.3 Rubi [A] (verified)

Time = 1.01 (sec) , antiderivative size = 226, normalized size of antiderivative = 1.00, number of steps used = 12, number of rules used = 12, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.414, Rules used = {3042, 4075, 3042, 4011, 3042, 4011, 3042, 4011, 3042, 4008, 3042, 3956}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \tan (c+d x) (a+b \tan (c+d x))^4 (A+B \tan (c+d x)) \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \tan (c+d x) (a+b \tan (c+d x))^4 (A+B \tan (c+d x))dx\)

\(\Big \downarrow \) 4075

\(\displaystyle \int (A \tan (c+d x)-B) (a+b \tan (c+d x))^4dx+\frac {B (a+b \tan (c+d x))^5}{5 b d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \int (A \tan (c+d x)-B) (a+b \tan (c+d x))^4dx+\frac {B (a+b \tan (c+d x))^5}{5 b d}\)

\(\Big \downarrow \) 4011

\(\displaystyle \int (a+b \tan (c+d x))^3 (-A b-a B+(a A-b B) \tan (c+d x))dx+\frac {A (a+b \tan (c+d x))^4}{4 d}+\frac {B (a+b \tan (c+d x))^5}{5 b d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \int (a+b \tan (c+d x))^3 (-A b-a B+(a A-b B) \tan (c+d x))dx+\frac {A (a+b \tan (c+d x))^4}{4 d}+\frac {B (a+b \tan (c+d x))^5}{5 b d}\)

\(\Big \downarrow \) 4011

\(\displaystyle \int (a+b \tan (c+d x))^2 \left (-B a^2-2 A b a+b^2 B+\left (A a^2-2 b B a-A b^2\right ) \tan (c+d x)\right )dx+\frac {(a A-b B) (a+b \tan (c+d x))^3}{3 d}+\frac {A (a+b \tan (c+d x))^4}{4 d}+\frac {B (a+b \tan (c+d x))^5}{5 b d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \int (a+b \tan (c+d x))^2 \left (-B a^2-2 A b a+b^2 B+\left (A a^2-2 b B a-A b^2\right ) \tan (c+d x)\right )dx+\frac {(a A-b B) (a+b \tan (c+d x))^3}{3 d}+\frac {A (a+b \tan (c+d x))^4}{4 d}+\frac {B (a+b \tan (c+d x))^5}{5 b d}\)

\(\Big \downarrow \) 4011

\(\displaystyle \int (a+b \tan (c+d x)) \left (-B a^3-3 A b a^2+3 b^2 B a+A b^3+\left (A a^3-3 b B a^2-3 A b^2 a+b^3 B\right ) \tan (c+d x)\right )dx+\frac {\left (a^2 A-2 a b B-A b^2\right ) (a+b \tan (c+d x))^2}{2 d}+\frac {(a A-b B) (a+b \tan (c+d x))^3}{3 d}+\frac {A (a+b \tan (c+d x))^4}{4 d}+\frac {B (a+b \tan (c+d x))^5}{5 b d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \int (a+b \tan (c+d x)) \left (-B a^3-3 A b a^2+3 b^2 B a+A b^3+\left (A a^3-3 b B a^2-3 A b^2 a+b^3 B\right ) \tan (c+d x)\right )dx+\frac {\left (a^2 A-2 a b B-A b^2\right ) (a+b \tan (c+d x))^2}{2 d}+\frac {(a A-b B) (a+b \tan (c+d x))^3}{3 d}+\frac {A (a+b \tan (c+d x))^4}{4 d}+\frac {B (a+b \tan (c+d x))^5}{5 b d}\)

\(\Big \downarrow \) 4008

\(\displaystyle \left (a^4 A-4 a^3 b B-6 a^2 A b^2+4 a b^3 B+A b^4\right ) \int \tan (c+d x)dx+\frac {\left (a^2 A-2 a b B-A b^2\right ) (a+b \tan (c+d x))^2}{2 d}+\frac {b \left (a^3 A-3 a^2 b B-3 a A b^2+b^3 B\right ) \tan (c+d x)}{d}-x \left (a^4 B+4 a^3 A b-6 a^2 b^2 B-4 a A b^3+b^4 B\right )+\frac {(a A-b B) (a+b \tan (c+d x))^3}{3 d}+\frac {A (a+b \tan (c+d x))^4}{4 d}+\frac {B (a+b \tan (c+d x))^5}{5 b d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \left (a^4 A-4 a^3 b B-6 a^2 A b^2+4 a b^3 B+A b^4\right ) \int \tan (c+d x)dx+\frac {\left (a^2 A-2 a b B-A b^2\right ) (a+b \tan (c+d x))^2}{2 d}+\frac {b \left (a^3 A-3 a^2 b B-3 a A b^2+b^3 B\right ) \tan (c+d x)}{d}-x \left (a^4 B+4 a^3 A b-6 a^2 b^2 B-4 a A b^3+b^4 B\right )+\frac {(a A-b B) (a+b \tan (c+d x))^3}{3 d}+\frac {A (a+b \tan (c+d x))^4}{4 d}+\frac {B (a+b \tan (c+d x))^5}{5 b d}\)

\(\Big \downarrow \) 3956

\(\displaystyle \frac {\left (a^2 A-2 a b B-A b^2\right ) (a+b \tan (c+d x))^2}{2 d}+\frac {b \left (a^3 A-3 a^2 b B-3 a A b^2+b^3 B\right ) \tan (c+d x)}{d}-\frac {\left (a^4 A-4 a^3 b B-6 a^2 A b^2+4 a b^3 B+A b^4\right ) \log (\cos (c+d x))}{d}-x \left (a^4 B+4 a^3 A b-6 a^2 b^2 B-4 a A b^3+b^4 B\right )+\frac {(a A-b B) (a+b \tan (c+d x))^3}{3 d}+\frac {A (a+b \tan (c+d x))^4}{4 d}+\frac {B (a+b \tan (c+d x))^5}{5 b d}\)

input
Int[Tan[c + d*x]*(a + b*Tan[c + d*x])^4*(A + B*Tan[c + d*x]),x]
 
output
-((4*a^3*A*b - 4*a*A*b^3 + a^4*B - 6*a^2*b^2*B + b^4*B)*x) - ((a^4*A - 6*a 
^2*A*b^2 + A*b^4 - 4*a^3*b*B + 4*a*b^3*B)*Log[Cos[c + d*x]])/d + (b*(a^3*A 
 - 3*a*A*b^2 - 3*a^2*b*B + b^3*B)*Tan[c + d*x])/d + ((a^2*A - A*b^2 - 2*a* 
b*B)*(a + b*Tan[c + d*x])^2)/(2*d) + ((a*A - b*B)*(a + b*Tan[c + d*x])^3)/ 
(3*d) + (A*(a + b*Tan[c + d*x])^4)/(4*d) + (B*(a + b*Tan[c + d*x])^5)/(5*b 
*d)
 

3.3.58.3.1 Defintions of rubi rules used

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3956
Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d 
*x], x]]/d, x] /; FreeQ[{c, d}, x]
 

rule 4008
Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.) 
*(x_)]), x_Symbol] :> Simp[(a*c - b*d)*x, x] + (Simp[b*d*(Tan[e + f*x]/f), 
x] + Simp[(b*c + a*d)   Int[Tan[e + f*x], x], x]) /; FreeQ[{a, b, c, d, e, 
f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]
 

rule 4011
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + 
 (f_.)*(x_)]), x_Symbol] :> Simp[d*((a + b*Tan[e + f*x])^m/(f*m)), x] + Int 
[(a + b*Tan[e + f*x])^(m - 1)*Simp[a*c - b*d + (b*c + a*d)*Tan[e + f*x], x] 
, x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 
 0] && GtQ[m, 0]
 

rule 4075
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) 
+ (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[B 
*d*((a + b*Tan[e + f*x])^(m + 1)/(b*f*(m + 1))), x] + Int[(a + b*Tan[e + f* 
x])^m*Simp[A*c - B*d + (B*c + A*d)*Tan[e + f*x], x], x] /; FreeQ[{a, b, c, 
d, e, f, A, B, m}, x] && NeQ[b*c - a*d, 0] &&  !LeQ[m, -1]
 
3.3.58.4 Maple [A] (verified)

Time = 0.13 (sec) , antiderivative size = 242, normalized size of antiderivative = 1.07

method result size
parts \(\frac {\left (A \,b^{4}+4 B a \,b^{3}\right ) \left (\frac {\left (\tan ^{4}\left (d x +c \right )\right )}{4}-\frac {\left (\tan ^{2}\left (d x +c \right )\right )}{2}+\frac {\ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}\right )}{d}+\frac {\left (4 A a \,b^{3}+6 B \,a^{2} b^{2}\right ) \left (\frac {\left (\tan ^{3}\left (d x +c \right )\right )}{3}-\tan \left (d x +c \right )+\arctan \left (\tan \left (d x +c \right )\right )\right )}{d}+\frac {\left (6 A \,a^{2} b^{2}+4 B \,a^{3} b \right ) \left (\frac {\left (\tan ^{2}\left (d x +c \right )\right )}{2}-\frac {\ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}\right )}{d}+\frac {\left (4 A \,a^{3} b +B \,a^{4}\right ) \left (\tan \left (d x +c \right )-\arctan \left (\tan \left (d x +c \right )\right )\right )}{d}+\frac {A \ln \left (1+\tan ^{2}\left (d x +c \right )\right ) a^{4}}{2 d}+\frac {B \,b^{4} \left (\frac {\left (\tan ^{5}\left (d x +c \right )\right )}{5}-\frac {\left (\tan ^{3}\left (d x +c \right )\right )}{3}+\tan \left (d x +c \right )-\arctan \left (\tan \left (d x +c \right )\right )\right )}{d}\) \(242\)
norman \(\left (-4 A \,a^{3} b +4 A a \,b^{3}-B \,a^{4}+6 B \,a^{2} b^{2}-B \,b^{4}\right ) x +\frac {\left (4 A \,a^{3} b -4 A a \,b^{3}+B \,a^{4}-6 B \,a^{2} b^{2}+B \,b^{4}\right ) \tan \left (d x +c \right )}{d}+\frac {B \,b^{4} \left (\tan ^{5}\left (d x +c \right )\right )}{5 d}+\frac {b \left (6 A \,a^{2} b -A \,b^{3}+4 B \,a^{3}-4 B a \,b^{2}\right ) \left (\tan ^{2}\left (d x +c \right )\right )}{2 d}+\frac {b^{2} \left (4 A a b +6 B \,a^{2}-B \,b^{2}\right ) \left (\tan ^{3}\left (d x +c \right )\right )}{3 d}+\frac {b^{3} \left (A b +4 B a \right ) \left (\tan ^{4}\left (d x +c \right )\right )}{4 d}+\frac {\left (A \,a^{4}-6 A \,a^{2} b^{2}+A \,b^{4}-4 B \,a^{3} b +4 B a \,b^{3}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d}\) \(250\)
derivativedivides \(\frac {\frac {B \,b^{4} \left (\tan ^{5}\left (d x +c \right )\right )}{5}+\frac {A \,b^{4} \left (\tan ^{4}\left (d x +c \right )\right )}{4}+B a \,b^{3} \left (\tan ^{4}\left (d x +c \right )\right )+\frac {4 A a \,b^{3} \left (\tan ^{3}\left (d x +c \right )\right )}{3}+2 B \,a^{2} b^{2} \left (\tan ^{3}\left (d x +c \right )\right )-\frac {B \,b^{4} \left (\tan ^{3}\left (d x +c \right )\right )}{3}+3 A \,a^{2} b^{2} \left (\tan ^{2}\left (d x +c \right )\right )-\frac {A \,b^{4} \left (\tan ^{2}\left (d x +c \right )\right )}{2}+2 B \,a^{3} b \left (\tan ^{2}\left (d x +c \right )\right )-2 B a \,b^{3} \left (\tan ^{2}\left (d x +c \right )\right )+4 A \,a^{3} b \tan \left (d x +c \right )-4 A a \,b^{3} \tan \left (d x +c \right )+B \tan \left (d x +c \right ) a^{4}-6 B \,a^{2} b^{2} \tan \left (d x +c \right )+B \,b^{4} \tan \left (d x +c \right )+\frac {\left (A \,a^{4}-6 A \,a^{2} b^{2}+A \,b^{4}-4 B \,a^{3} b +4 B a \,b^{3}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (-4 A \,a^{3} b +4 A a \,b^{3}-B \,a^{4}+6 B \,a^{2} b^{2}-B \,b^{4}\right ) \arctan \left (\tan \left (d x +c \right )\right )}{d}\) \(309\)
default \(\frac {\frac {B \,b^{4} \left (\tan ^{5}\left (d x +c \right )\right )}{5}+\frac {A \,b^{4} \left (\tan ^{4}\left (d x +c \right )\right )}{4}+B a \,b^{3} \left (\tan ^{4}\left (d x +c \right )\right )+\frac {4 A a \,b^{3} \left (\tan ^{3}\left (d x +c \right )\right )}{3}+2 B \,a^{2} b^{2} \left (\tan ^{3}\left (d x +c \right )\right )-\frac {B \,b^{4} \left (\tan ^{3}\left (d x +c \right )\right )}{3}+3 A \,a^{2} b^{2} \left (\tan ^{2}\left (d x +c \right )\right )-\frac {A \,b^{4} \left (\tan ^{2}\left (d x +c \right )\right )}{2}+2 B \,a^{3} b \left (\tan ^{2}\left (d x +c \right )\right )-2 B a \,b^{3} \left (\tan ^{2}\left (d x +c \right )\right )+4 A \,a^{3} b \tan \left (d x +c \right )-4 A a \,b^{3} \tan \left (d x +c \right )+B \tan \left (d x +c \right ) a^{4}-6 B \,a^{2} b^{2} \tan \left (d x +c \right )+B \,b^{4} \tan \left (d x +c \right )+\frac {\left (A \,a^{4}-6 A \,a^{2} b^{2}+A \,b^{4}-4 B \,a^{3} b +4 B a \,b^{3}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (-4 A \,a^{3} b +4 A a \,b^{3}-B \,a^{4}+6 B \,a^{2} b^{2}-B \,b^{4}\right ) \arctan \left (\tan \left (d x +c \right )\right )}{d}\) \(309\)
parallelrisch \(\frac {60 B \,b^{4} \tan \left (d x +c \right )-60 B x \,a^{4} d +360 B \,a^{2} b^{2} d x -240 A \,a^{3} b d x +240 A a \,b^{3} d x +240 A \,a^{3} b \tan \left (d x +c \right )-240 A a \,b^{3} \tan \left (d x +c \right )-360 B \,a^{2} b^{2} \tan \left (d x +c \right )+30 A \ln \left (1+\tan ^{2}\left (d x +c \right )\right ) a^{4}-30 A \,b^{4} \left (\tan ^{2}\left (d x +c \right )\right )+15 A \,b^{4} \left (\tan ^{4}\left (d x +c \right )\right )-20 B \,b^{4} \left (\tan ^{3}\left (d x +c \right )\right )+12 B \,b^{4} \left (\tan ^{5}\left (d x +c \right )\right )+30 A \ln \left (1+\tan ^{2}\left (d x +c \right )\right ) b^{4}+60 B \tan \left (d x +c \right ) a^{4}-60 B \,b^{4} d x +60 B a \,b^{3} \left (\tan ^{4}\left (d x +c \right )\right )+80 A a \,b^{3} \left (\tan ^{3}\left (d x +c \right )\right )+120 B \,a^{2} b^{2} \left (\tan ^{3}\left (d x +c \right )\right )+180 A \,a^{2} b^{2} \left (\tan ^{2}\left (d x +c \right )\right )+120 B \,a^{3} b \left (\tan ^{2}\left (d x +c \right )\right )-120 B a \,b^{3} \left (\tan ^{2}\left (d x +c \right )\right )-180 A \ln \left (1+\tan ^{2}\left (d x +c \right )\right ) a^{2} b^{2}-120 B \ln \left (1+\tan ^{2}\left (d x +c \right )\right ) a^{3} b +120 B \ln \left (1+\tan ^{2}\left (d x +c \right )\right ) a \,b^{3}}{60 d}\) \(357\)
risch \(-\frac {12 i A \,a^{2} b^{2} c}{d}+\frac {8 i B a \,b^{3} c}{d}+\frac {2 i \left (60 A \,a^{3} b -80 A a \,b^{3}-120 B \,a^{2} b^{2}+15 B \,a^{4}+23 B \,b^{4}-270 i A \,a^{2} b^{2} {\mathrm e}^{6 i \left (d x +c \right )}-180 i B \,a^{3} b \,{\mathrm e}^{6 i \left (d x +c \right )}+240 i B a \,b^{3} {\mathrm e}^{6 i \left (d x +c \right )}-270 i A \,a^{2} b^{2} {\mathrm e}^{4 i \left (d x +c \right )}-90 i A \,a^{2} b^{2} {\mathrm e}^{2 i \left (d x +c \right )}-60 i B \,a^{3} b \,{\mathrm e}^{2 i \left (d x +c \right )}+120 i B a \,b^{3} {\mathrm e}^{2 i \left (d x +c \right )}-90 i A \,a^{2} b^{2} {\mathrm e}^{8 i \left (d x +c \right )}-60 i B \,a^{3} b \,{\mathrm e}^{8 i \left (d x +c \right )}+120 i B a \,b^{3} {\mathrm e}^{8 i \left (d x +c \right )}-180 i B \,a^{3} b \,{\mathrm e}^{4 i \left (d x +c \right )}+240 i B a \,b^{3} {\mathrm e}^{4 i \left (d x +c \right )}+60 B \,a^{4} {\mathrm e}^{2 i \left (d x +c \right )}+90 B \,a^{4} {\mathrm e}^{4 i \left (d x +c \right )}+60 B \,a^{4} {\mathrm e}^{6 i \left (d x +c \right )}+15 B \,a^{4} {\mathrm e}^{8 i \left (d x +c \right )}+90 B \,b^{4} {\mathrm e}^{6 i \left (d x +c \right )}+140 B \,b^{4} {\mathrm e}^{4 i \left (d x +c \right )}+70 B \,b^{4} {\mathrm e}^{2 i \left (d x +c \right )}+45 B \,b^{4} {\mathrm e}^{8 i \left (d x +c \right )}+30 i A \,b^{4} {\mathrm e}^{2 i \left (d x +c \right )}+60 i A \,b^{4} {\mathrm e}^{4 i \left (d x +c \right )}+30 i A \,b^{4} {\mathrm e}^{8 i \left (d x +c \right )}+60 i A \,b^{4} {\mathrm e}^{6 i \left (d x +c \right )}-420 B \,a^{2} b^{2} {\mathrm e}^{2 i \left (d x +c \right )}-120 A a \,b^{3} {\mathrm e}^{8 i \left (d x +c \right )}-180 B \,a^{2} b^{2} {\mathrm e}^{8 i \left (d x +c \right )}-360 A a \,b^{3} {\mathrm e}^{6 i \left (d x +c \right )}-540 B \,a^{2} b^{2} {\mathrm e}^{6 i \left (d x +c \right )}+60 A \,a^{3} b \,{\mathrm e}^{8 i \left (d x +c \right )}+240 A \,a^{3} b \,{\mathrm e}^{6 i \left (d x +c \right )}+360 A \,a^{3} b \,{\mathrm e}^{4 i \left (d x +c \right )}+240 A \,a^{3} b \,{\mathrm e}^{2 i \left (d x +c \right )}-440 A a \,b^{3} {\mathrm e}^{4 i \left (d x +c \right )}-660 B \,a^{2} b^{2} {\mathrm e}^{4 i \left (d x +c \right )}-280 A a \,b^{3} {\mathrm e}^{2 i \left (d x +c \right )}\right )}{15 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{5}}+i A \,a^{4} x -\frac {a^{4} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) A}{d}-\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) A \,b^{4}}{d}-4 A \,a^{3} b x +4 A a \,b^{3} x +6 B \,a^{2} b^{2} x +4 i B a \,b^{3} x +\frac {2 i a^{4} A c}{d}-B \,a^{4} x -B \,b^{4} x +\frac {2 i A \,b^{4} c}{d}-\frac {8 i B \,a^{3} b c}{d}+\frac {6 \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) A \,a^{2} b^{2}}{d}+\frac {4 \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B \,a^{3} b}{d}-\frac {4 \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B a \,b^{3}}{d}+i A \,b^{4} x -6 i A \,a^{2} b^{2} x -4 i B \,a^{3} b x\) \(908\)

input
int(tan(d*x+c)*(a+b*tan(d*x+c))^4*(A+B*tan(d*x+c)),x,method=_RETURNVERBOSE 
)
 
output
(A*b^4+4*B*a*b^3)/d*(1/4*tan(d*x+c)^4-1/2*tan(d*x+c)^2+1/2*ln(1+tan(d*x+c) 
^2))+(4*A*a*b^3+6*B*a^2*b^2)/d*(1/3*tan(d*x+c)^3-tan(d*x+c)+arctan(tan(d*x 
+c)))+(6*A*a^2*b^2+4*B*a^3*b)/d*(1/2*tan(d*x+c)^2-1/2*ln(1+tan(d*x+c)^2))+ 
(4*A*a^3*b+B*a^4)/d*(tan(d*x+c)-arctan(tan(d*x+c)))+1/2/d*A*ln(1+tan(d*x+c 
)^2)*a^4+B*b^4/d*(1/5*tan(d*x+c)^5-1/3*tan(d*x+c)^3+tan(d*x+c)-arctan(tan( 
d*x+c)))
 
3.3.58.5 Fricas [A] (verification not implemented)

Time = 0.27 (sec) , antiderivative size = 245, normalized size of antiderivative = 1.08 \[ \int \tan (c+d x) (a+b \tan (c+d x))^4 (A+B \tan (c+d x)) \, dx=\frac {12 \, B b^{4} \tan \left (d x + c\right )^{5} + 15 \, {\left (4 \, B a b^{3} + A b^{4}\right )} \tan \left (d x + c\right )^{4} + 20 \, {\left (6 \, B a^{2} b^{2} + 4 \, A a b^{3} - B b^{4}\right )} \tan \left (d x + c\right )^{3} - 60 \, {\left (B a^{4} + 4 \, A a^{3} b - 6 \, B a^{2} b^{2} - 4 \, A a b^{3} + B b^{4}\right )} d x + 30 \, {\left (4 \, B a^{3} b + 6 \, A a^{2} b^{2} - 4 \, B a b^{3} - A b^{4}\right )} \tan \left (d x + c\right )^{2} - 30 \, {\left (A a^{4} - 4 \, B a^{3} b - 6 \, A a^{2} b^{2} + 4 \, B a b^{3} + A b^{4}\right )} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right ) + 60 \, {\left (B a^{4} + 4 \, A a^{3} b - 6 \, B a^{2} b^{2} - 4 \, A a b^{3} + B b^{4}\right )} \tan \left (d x + c\right )}{60 \, d} \]

input
integrate(tan(d*x+c)*(a+b*tan(d*x+c))^4*(A+B*tan(d*x+c)),x, algorithm="fri 
cas")
 
output
1/60*(12*B*b^4*tan(d*x + c)^5 + 15*(4*B*a*b^3 + A*b^4)*tan(d*x + c)^4 + 20 
*(6*B*a^2*b^2 + 4*A*a*b^3 - B*b^4)*tan(d*x + c)^3 - 60*(B*a^4 + 4*A*a^3*b 
- 6*B*a^2*b^2 - 4*A*a*b^3 + B*b^4)*d*x + 30*(4*B*a^3*b + 6*A*a^2*b^2 - 4*B 
*a*b^3 - A*b^4)*tan(d*x + c)^2 - 30*(A*a^4 - 4*B*a^3*b - 6*A*a^2*b^2 + 4*B 
*a*b^3 + A*b^4)*log(1/(tan(d*x + c)^2 + 1)) + 60*(B*a^4 + 4*A*a^3*b - 6*B* 
a^2*b^2 - 4*A*a*b^3 + B*b^4)*tan(d*x + c))/d
 
3.3.58.6 Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 437 vs. \(2 (214) = 428\).

Time = 0.19 (sec) , antiderivative size = 437, normalized size of antiderivative = 1.93 \[ \int \tan (c+d x) (a+b \tan (c+d x))^4 (A+B \tan (c+d x)) \, dx=\begin {cases} \frac {A a^{4} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} - 4 A a^{3} b x + \frac {4 A a^{3} b \tan {\left (c + d x \right )}}{d} - \frac {3 A a^{2} b^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{d} + \frac {3 A a^{2} b^{2} \tan ^{2}{\left (c + d x \right )}}{d} + 4 A a b^{3} x + \frac {4 A a b^{3} \tan ^{3}{\left (c + d x \right )}}{3 d} - \frac {4 A a b^{3} \tan {\left (c + d x \right )}}{d} + \frac {A b^{4} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {A b^{4} \tan ^{4}{\left (c + d x \right )}}{4 d} - \frac {A b^{4} \tan ^{2}{\left (c + d x \right )}}{2 d} - B a^{4} x + \frac {B a^{4} \tan {\left (c + d x \right )}}{d} - \frac {2 B a^{3} b \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{d} + \frac {2 B a^{3} b \tan ^{2}{\left (c + d x \right )}}{d} + 6 B a^{2} b^{2} x + \frac {2 B a^{2} b^{2} \tan ^{3}{\left (c + d x \right )}}{d} - \frac {6 B a^{2} b^{2} \tan {\left (c + d x \right )}}{d} + \frac {2 B a b^{3} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{d} + \frac {B a b^{3} \tan ^{4}{\left (c + d x \right )}}{d} - \frac {2 B a b^{3} \tan ^{2}{\left (c + d x \right )}}{d} - B b^{4} x + \frac {B b^{4} \tan ^{5}{\left (c + d x \right )}}{5 d} - \frac {B b^{4} \tan ^{3}{\left (c + d x \right )}}{3 d} + \frac {B b^{4} \tan {\left (c + d x \right )}}{d} & \text {for}\: d \neq 0 \\x \left (A + B \tan {\left (c \right )}\right ) \left (a + b \tan {\left (c \right )}\right )^{4} \tan {\left (c \right )} & \text {otherwise} \end {cases} \]

input
integrate(tan(d*x+c)*(a+b*tan(d*x+c))**4*(A+B*tan(d*x+c)),x)
 
output
Piecewise((A*a**4*log(tan(c + d*x)**2 + 1)/(2*d) - 4*A*a**3*b*x + 4*A*a**3 
*b*tan(c + d*x)/d - 3*A*a**2*b**2*log(tan(c + d*x)**2 + 1)/d + 3*A*a**2*b* 
*2*tan(c + d*x)**2/d + 4*A*a*b**3*x + 4*A*a*b**3*tan(c + d*x)**3/(3*d) - 4 
*A*a*b**3*tan(c + d*x)/d + A*b**4*log(tan(c + d*x)**2 + 1)/(2*d) + A*b**4* 
tan(c + d*x)**4/(4*d) - A*b**4*tan(c + d*x)**2/(2*d) - B*a**4*x + B*a**4*t 
an(c + d*x)/d - 2*B*a**3*b*log(tan(c + d*x)**2 + 1)/d + 2*B*a**3*b*tan(c + 
 d*x)**2/d + 6*B*a**2*b**2*x + 2*B*a**2*b**2*tan(c + d*x)**3/d - 6*B*a**2* 
b**2*tan(c + d*x)/d + 2*B*a*b**3*log(tan(c + d*x)**2 + 1)/d + B*a*b**3*tan 
(c + d*x)**4/d - 2*B*a*b**3*tan(c + d*x)**2/d - B*b**4*x + B*b**4*tan(c + 
d*x)**5/(5*d) - B*b**4*tan(c + d*x)**3/(3*d) + B*b**4*tan(c + d*x)/d, Ne(d 
, 0)), (x*(A + B*tan(c))*(a + b*tan(c))**4*tan(c), True))
 
3.3.58.7 Maxima [A] (verification not implemented)

Time = 0.30 (sec) , antiderivative size = 246, normalized size of antiderivative = 1.09 \[ \int \tan (c+d x) (a+b \tan (c+d x))^4 (A+B \tan (c+d x)) \, dx=\frac {12 \, B b^{4} \tan \left (d x + c\right )^{5} + 15 \, {\left (4 \, B a b^{3} + A b^{4}\right )} \tan \left (d x + c\right )^{4} + 20 \, {\left (6 \, B a^{2} b^{2} + 4 \, A a b^{3} - B b^{4}\right )} \tan \left (d x + c\right )^{3} + 30 \, {\left (4 \, B a^{3} b + 6 \, A a^{2} b^{2} - 4 \, B a b^{3} - A b^{4}\right )} \tan \left (d x + c\right )^{2} - 60 \, {\left (B a^{4} + 4 \, A a^{3} b - 6 \, B a^{2} b^{2} - 4 \, A a b^{3} + B b^{4}\right )} {\left (d x + c\right )} + 30 \, {\left (A a^{4} - 4 \, B a^{3} b - 6 \, A a^{2} b^{2} + 4 \, B a b^{3} + A b^{4}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 60 \, {\left (B a^{4} + 4 \, A a^{3} b - 6 \, B a^{2} b^{2} - 4 \, A a b^{3} + B b^{4}\right )} \tan \left (d x + c\right )}{60 \, d} \]

input
integrate(tan(d*x+c)*(a+b*tan(d*x+c))^4*(A+B*tan(d*x+c)),x, algorithm="max 
ima")
 
output
1/60*(12*B*b^4*tan(d*x + c)^5 + 15*(4*B*a*b^3 + A*b^4)*tan(d*x + c)^4 + 20 
*(6*B*a^2*b^2 + 4*A*a*b^3 - B*b^4)*tan(d*x + c)^3 + 30*(4*B*a^3*b + 6*A*a^ 
2*b^2 - 4*B*a*b^3 - A*b^4)*tan(d*x + c)^2 - 60*(B*a^4 + 4*A*a^3*b - 6*B*a^ 
2*b^2 - 4*A*a*b^3 + B*b^4)*(d*x + c) + 30*(A*a^4 - 4*B*a^3*b - 6*A*a^2*b^2 
 + 4*B*a*b^3 + A*b^4)*log(tan(d*x + c)^2 + 1) + 60*(B*a^4 + 4*A*a^3*b - 6* 
B*a^2*b^2 - 4*A*a*b^3 + B*b^4)*tan(d*x + c))/d
 
3.3.58.8 Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 4489 vs. \(2 (218) = 436\).

Time = 4.84 (sec) , antiderivative size = 4489, normalized size of antiderivative = 19.86 \[ \int \tan (c+d x) (a+b \tan (c+d x))^4 (A+B \tan (c+d x)) \, dx=\text {Too large to display} \]

input
integrate(tan(d*x+c)*(a+b*tan(d*x+c))^4*(A+B*tan(d*x+c)),x, algorithm="gia 
c")
 
output
-1/60*(60*B*a^4*d*x*tan(d*x)^5*tan(c)^5 + 240*A*a^3*b*d*x*tan(d*x)^5*tan(c 
)^5 - 360*B*a^2*b^2*d*x*tan(d*x)^5*tan(c)^5 - 240*A*a*b^3*d*x*tan(d*x)^5*t 
an(c)^5 + 60*B*b^4*d*x*tan(d*x)^5*tan(c)^5 + 30*A*a^4*log(4*(tan(d*x)^2*ta 
n(c)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(d*x)^2*tan(c)^2 + tan(d*x)^2 + tan(c) 
^2 + 1))*tan(d*x)^5*tan(c)^5 - 120*B*a^3*b*log(4*(tan(d*x)^2*tan(c)^2 - 2* 
tan(d*x)*tan(c) + 1)/(tan(d*x)^2*tan(c)^2 + tan(d*x)^2 + tan(c)^2 + 1))*ta 
n(d*x)^5*tan(c)^5 - 180*A*a^2*b^2*log(4*(tan(d*x)^2*tan(c)^2 - 2*tan(d*x)* 
tan(c) + 1)/(tan(d*x)^2*tan(c)^2 + tan(d*x)^2 + tan(c)^2 + 1))*tan(d*x)^5* 
tan(c)^5 + 120*B*a*b^3*log(4*(tan(d*x)^2*tan(c)^2 - 2*tan(d*x)*tan(c) + 1) 
/(tan(d*x)^2*tan(c)^2 + tan(d*x)^2 + tan(c)^2 + 1))*tan(d*x)^5*tan(c)^5 + 
30*A*b^4*log(4*(tan(d*x)^2*tan(c)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(d*x)^2*t 
an(c)^2 + tan(d*x)^2 + tan(c)^2 + 1))*tan(d*x)^5*tan(c)^5 - 300*B*a^4*d*x* 
tan(d*x)^4*tan(c)^4 - 1200*A*a^3*b*d*x*tan(d*x)^4*tan(c)^4 + 1800*B*a^2*b^ 
2*d*x*tan(d*x)^4*tan(c)^4 + 1200*A*a*b^3*d*x*tan(d*x)^4*tan(c)^4 - 300*B*b 
^4*d*x*tan(d*x)^4*tan(c)^4 - 120*B*a^3*b*tan(d*x)^5*tan(c)^5 - 180*A*a^2*b 
^2*tan(d*x)^5*tan(c)^5 + 180*B*a*b^3*tan(d*x)^5*tan(c)^5 + 45*A*b^4*tan(d* 
x)^5*tan(c)^5 - 150*A*a^4*log(4*(tan(d*x)^2*tan(c)^2 - 2*tan(d*x)*tan(c) + 
 1)/(tan(d*x)^2*tan(c)^2 + tan(d*x)^2 + tan(c)^2 + 1))*tan(d*x)^4*tan(c)^4 
 + 600*B*a^3*b*log(4*(tan(d*x)^2*tan(c)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(d* 
x)^2*tan(c)^2 + tan(d*x)^2 + tan(c)^2 + 1))*tan(d*x)^4*tan(c)^4 + 900*A...
 
3.3.58.9 Mupad [B] (verification not implemented)

Time = 8.52 (sec) , antiderivative size = 251, normalized size of antiderivative = 1.11 \[ \int \tan (c+d x) (a+b \tan (c+d x))^4 (A+B \tan (c+d x)) \, dx=\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (B\,a^4+B\,b^4+4\,A\,a^3\,b-2\,a\,b^2\,\left (2\,A\,b+3\,B\,a\right )\right )}{d}-\frac {{\mathrm {tan}\left (c+d\,x\right )}^2\,\left (\frac {A\,b^4}{2}+2\,B\,a\,b^3-a^2\,b\,\left (3\,A\,b+2\,B\,a\right )\right )}{d}-x\,\left (B\,a^4+4\,A\,a^3\,b-6\,B\,a^2\,b^2-4\,A\,a\,b^3+B\,b^4\right )+\frac {{\mathrm {tan}\left (c+d\,x\right )}^4\,\left (\frac {A\,b^4}{4}+B\,a\,b^3\right )}{d}+\frac {\ln \left ({\mathrm {tan}\left (c+d\,x\right )}^2+1\right )\,\left (\frac {A\,a^4}{2}-2\,B\,a^3\,b-3\,A\,a^2\,b^2+2\,B\,a\,b^3+\frac {A\,b^4}{2}\right )}{d}-\frac {{\mathrm {tan}\left (c+d\,x\right )}^3\,\left (\frac {B\,b^4}{3}-\frac {2\,a\,b^2\,\left (2\,A\,b+3\,B\,a\right )}{3}\right )}{d}+\frac {B\,b^4\,{\mathrm {tan}\left (c+d\,x\right )}^5}{5\,d} \]

input
int(tan(c + d*x)*(A + B*tan(c + d*x))*(a + b*tan(c + d*x))^4,x)
 
output
(tan(c + d*x)*(B*a^4 + B*b^4 + 4*A*a^3*b - 2*a*b^2*(2*A*b + 3*B*a)))/d - ( 
tan(c + d*x)^2*((A*b^4)/2 + 2*B*a*b^3 - a^2*b*(3*A*b + 2*B*a)))/d - x*(B*a 
^4 + B*b^4 - 6*B*a^2*b^2 - 4*A*a*b^3 + 4*A*a^3*b) + (tan(c + d*x)^4*((A*b^ 
4)/4 + B*a*b^3))/d + (log(tan(c + d*x)^2 + 1)*((A*a^4)/2 + (A*b^4)/2 - 3*A 
*a^2*b^2 + 2*B*a*b^3 - 2*B*a^3*b))/d - (tan(c + d*x)^3*((B*b^4)/3 - (2*a*b 
^2*(2*A*b + 3*B*a))/3))/d + (B*b^4*tan(c + d*x)^5)/(5*d)